import cv2
import matplotlib.pyplot as plt
image=cv2.imread("q.jpeg")
hist=cv2.calcHist([image],[0],None,[256],[0,255])
plt.plot(hist)
plt.show()